﻿<UserControl
	x:Class="PrismInteractionLack.ViewControl"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
	xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
	xmlns:prism="clr-namespace:Microsoft.Practices.Prism.Interactivity.InteractionRequest;assembly=Microsoft.Practices.Prism.Interactivity"
	xmlns:PrismInteractionLack="clr-namespace:PrismInteractionLack"
	xmlns:System="clr-namespace:System;assembly=mscorlib"
	mc:Ignorable="d"
			 
	MinWidth="300"
	MinHeight="100"
	d:DesignHeight="500"
	d:DesignWidth="400"
	>


	<UserControl.Resources>
		<System:String x:Key="Guid">Interaction is not attached.</System:String>
	</UserControl.Resources>


	<i:Interaction.Triggers>

		<prism:InteractionRequestTrigger SourceObject="{Binding MyСonfirmationRequest}">
			<prism:PopupChildWindowAction/>
		</prism:InteractionRequestTrigger>

		<prism:InteractionRequestTrigger SourceObject="{Binding MyWeakСonfirmationRequest}">
			<prism:PopupChildWindowAction/>
		</prism:InteractionRequestTrigger>

		<PrismInteractionLack:UnloadableInteractionRequestTrigger SourceObject="{Binding MyUnloadableСonfirmationRequest}">
			<prism:PopupChildWindowAction/>
		</PrismInteractionLack:UnloadableInteractionRequestTrigger>

	</i:Interaction.Triggers>


	<UserControl.DataContext>
		<Binding Source="{StaticResource ViewModel}" />
	</UserControl.DataContext>


	<StackPanel>


		<Grid Margin="20"/>
		<TextBlock TextWrapping="Wrap">
			That's it! The bug!
		</TextBlock>

		<Button Content="Try СonfirmationRequest" Click="MyСonfirmationRequestClick" />


		<Grid Margin="20"/>
		<TextBlock TextWrapping="Wrap">
			<Bold>Unfortunate workaround 1.</Bold>
			<LineBreak/>
			It's the "Weak Event Patterns" and it is overwhelmed.
			<LineBreak/>
			This don't solve the bug.
			<LineBreak/>
			It's taken from the:
		</TextBlock>
		<HyperlinkButton TargetName="_blank" NavigateUri="http://compositewpf.codeplex.com/workitem/8532" Content="InteractionRequestTrigger can cause memory leaks with some implementations."/>

		<Button Content="Try WeakСonfirmationRequest" Click="MyWeakСonfirmationRequestClick" />


		<Grid Margin="20"/>
		<TextBlock TextWrapping="Wrap">
			<Bold>Unfortunate workaround 2.</Bold>
			<LineBreak/>
			Every View creates its own InteractionRequestTrigger object and it's has no sense to modify it.
			<LineBreak/>
			I should to say that the detaching at the InteractionRequestTrigger don't work, at all. Look it at code here.
			<LineBreak/>
			Taken from the:
		</TextBlock>
		<HyperlinkButton TargetName="_blank" NavigateUri="http://blog.kutulu.org/2012/02/out-of-control-interactionrequesttrigge.html" Content="Out Of Control InteractionRequestTriggers"/>

		<Button Content="Try UnloadableСonfirmationRequest" Click="MyUnloadableСonfirmationRequestClick" />





		<Grid Margin="20"/>

		<Border x:Name="LayoutRoot" Background="White" BorderThickness="3" CornerRadius="4" BorderBrush="Red">
			<ContentControl HorizontalAlignment="Center" VerticalAlignment="Center" Content="{StaticResource Guid}"/>
		</Border>
	</StackPanel>

</UserControl>
